import java.util.Arrays;


public class Majority {
	 public int majorityElement(int[] num) {
//	     quick(num,0,num.length-1);
		 Arrays.sort(num);
	     return(num[num.length>>1]);
     }
	 
	 
	 public void quick(int []num,int start,int end){
		 if(start<end){
			 int direct=quickSort(num,start,end);
			 quick(num,start,direct-1);
			 quick(num,direct+1,end);
		 }
	 }
	 
	 public int quickSort(int[] num,int start,int end){
		 int temp=num[start];
		 while(start<end){
			 while(start<end&&num[end]>=temp){
				 end--;
			 };
		    	 num[start]=num[end];
			 while(start<end&&num[start]<=temp){
				 start++;
			 }
		         num[end]=num[start];
		 }
		 num[start]=temp;
		 return start;
	 }
	 public static void main(String[] args) {
		Majority m=new Majority();
		m.majorityElement(new int[]{2,2,1});
	}
}
